﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "GmFamilyService.h"
#include "IFamilyConnector3d.h"
#include "ContainerUtil.h"
#include "MEPConnectorEnums.h"

namespace gcmp
{
    class IGraphicsBRepEdge;
}

namespace gfam
{
    /// \brief 机电连接件
    class GM_FAMILY_SERVICE_EXPORT IFamilyMEPConnector : public IFamilyConnector3d
    {
        DEFINE_CAST_DERIVED(gfam::IFamilyMEPConnector, gfam::IFamilyConnector3d)

    public:
        /// \brief 创建机电连接件
        ///
        /// \param pDocument 文档指针，输入为空时，创建机电连接件失败，返回nullptr
        /// \param pNodeReference 连接件引用对象
        /// \param pEdges 连接件引用对象(边的图形节点)
        /// \param pConnectorShape 连接件形状
        /// \param pConnectorType 连接件类型
        /// \return 创建成功返回机电连接件指针，创建失败返回nullptr
        static IFamilyMEPConnector* Create(gcmp::IDocument* pDocument, const gcmp::IGraphicsNodeReference* pNodeReference, const gcmp::GraphicsNodeReferenceOwnerPtrVector& pEdges, const IFamilyConnectorShape *pConnectorShape, const IFamilyConnectorType *pConnectorType);

        /// \brief 创建机电连接件
        ///
        /// \param pDocument 文档指针，输入为空时，创建机电连接件失败，返回nullptr
        /// \param pNodeReference 连接件引用对象
        /// \param pEdges 连接件引用对象(边)
        /// \param pConnectorShape 连接件形状
        /// \param pConnectorType 连接件类型
        /// \return 创建成功返回机电连接件指针，创建失败返回nullptr
        static IFamilyMEPConnector* Create(gcmp::IDocument* pDocument, const gcmp::IGraphicsNodeReference* pNodeReference, std::vector<const gcmp::IGraphicsBRepEdge*> pEdges, const IFamilyConnectorShape *pConnectorShape, const IFamilyConnectorType *pConnectorType);

        /// \brief 获取与之关联的机电连接点的ElementId
        ///
        /// \return 与之关联的机电连接点的ElementId
        virtual gcmp::ElementId GetLinkedConnectorElementId() const = 0; 

        /// \brief 设置与之关联的机电连接点的ElementId
        ///
        /// \param linkedId 与之关联的机电连接点的ElementId
        GCMP_DEPRECATED_API(2023 / 10 / 01) virtual void SetLinkedConnectorElementId(gcmp::ElementId linkedId) = 0;

        /// \brief 获取是否配置了二维连接点
        ///
        /// \return 如果匹配了二维连接点，返回true，否则返回false
        virtual bool IsMatchConnector2d() const = 0;

        /// \brief 设置是否配置了二维连接点
        ///
        /// \param isMatchConnector2d 是否配对二维连接点
        virtual void SetIsMatchConnector2d(bool isMatchConnector2d) = 0;

        /// \brief 获得三维连接件存储的二维连接点坐标系
        ///
        /// \return 二维连接点坐标系
        virtual gcmp::Coordinate3d GetConnector2dCoordinate() const = 0;

        /// \brief 获得三维连接件存储的二维连接点坐标系
        ///
        /// \return param 二维连接点坐标系
        virtual void SetConnector2dCoordinate(const gcmp::Coordinate3d& coord) = 0;

        /// \brief 获得三维连接件存储的二维连接点表
        ///
        /// \return 参数映射表，Key为二维连接点的名字，Coordinate3d为二维连接点坐标系
        virtual const std::map<std::wstring, gcmp::Coordinate3d>& GetConnector2dCoordinates() const = 0;

        /// \brief 设置三维连接点存储的二维连接点表
        ///
        /// \param connector2dCoordinates 三维连接点存储的二维连接点表
        virtual void SetConnector2dCoordinates(const std::map<std::wstring, gcmp::Coordinate3d>& connector2dCoordinates) = 0;

        /// \brief 获取水管连接件系统类型
        ///
        /// \return 如果是水管，返回水管类型 否则返回WaterSystemType::UndefinedSystemType
        virtual WaterSystemType GetWaterSystemType() const = 0;

         /// \brief 设置水管连接件系统类型
        ///
        /// \param type 水管连接件系统类型
        virtual void SetWaterSystemType(const WaterSystemType& type) = 0;

        /// \brief 获取风管连接件系统类型
        ///
        /// \return 如果是风管，返回风管连接件类型 否则返回VentilatingSystemType::UndefinedSystemType
        virtual VentilatingSystemType GetVentilatingSystemType() const = 0;

        /// \brief 设置风管连接件系统类型
        ///
        /// \param type 风管连接件系统类型
        virtual void SetVentilatingSystemType(const VentilatingSystemType& type) = 0;

        /// \brief 获取电气连接件系统类型
        ///
        /// \return 如果是电气，返回电气连接件类型 否则返回ElectricalSystemType::UndefinedSystemType
        virtual ElectricalSystemType GetElectricalSystemType() const = 0;

        /// \brief 设置电气连接件系统类型
        ///
        /// \param type 电气连接件系统类型
        virtual void SetElectricalSystemType(const ElectricalSystemType& type) = 0;

        /// \brief 获取桥架连接件系统类型
        ///
        /// \return 如果是桥架连接件，返回桥架连接件类型 否则返回CableTraySystemType::CTS_UndefinedSystemType
        virtual CableTraySystemType GetCableTraySystemType() const = 0;

        /// \brief 设置桥架连接件系统类型
        ///
        /// \param type 桥架连接件系统类型
        virtual void SetCableTraySystemType(const CableTraySystemType& type) = 0;

        /// \brief 获取线管连接件系统类型
        ///
        /// \return 如果是线管连接件，返回线管连接件类型 否则返回WireSystemType::WireNodefine
        virtual WireSystemType GetWireSystemType() const = 0;

        /// \brief 设置线管连接件系统类型
        ///
        /// \param type 线管连接件系统类型
        virtual void SetWireSystemType(const WireSystemType& type) = 0;

        /// \brief 获取Implementation Uid
        ///
        /// \return UniIdentity 返回ImplementationUid
        static gcmp::UniIdentity GetImplementationUid();

    };

} 
